package sy.test.java.util.concurrent;

import java.util.concurrent.Callable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Task implements Callable<B> {

	private Logger logger = LoggerFactory.getLogger(this.getClass());
	private B b;

	public Task(B b) {
		this.b = b;
	}

	@Override
	public B call() throws Exception {
		System.out.println("线程：" + Thread.currentThread().getName() + "开始处理sql；" + b.getDid());
		try {
			Thread.sleep((int) (Math.random() * 5000));
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("线程：" + Thread.currentThread().getName() + "结束处理sql；" + b.getDid());
		b.setTotal(100);
		return b;
	}

}
